package huytq.gs.view;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.WakeLockOptions;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.ui.activity.SimpleLayoutGameActivity;

import com.example.paralletkill.R;

import android.app.Activity;
import android.app.Dialog;
import android.util.Log;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class CaiDat extends SimpleLayoutGameActivity{
	private Activity activity;
	private Dialog dialog;
	
	private static final int WIDTH = 800;
    private static final int HEIGHT = 480;
   
    private Scene _scene;
    private Camera _camera;
    
    public static Sprite sprite;
    VertexBufferObjectManager vbom;
    
    ImageView img_Close_CaiDat;
    SeekBar sb_amThanh;
    
    public CaiDat(Activity activity) {
		this.activity = activity;
		dialog = new Dialog(activity,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
		dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

		dialog.setCancelable(true);

		dialog.setContentView(R.layout.caidat);

		dialog.show();
	}
	
	@Override
	public EngineOptions onCreateEngineOptions() {
		_camera = new Camera(0, 0, WIDTH, HEIGHT);
        EngineOptions engineOptions = new EngineOptions(true,
                        ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), _camera);
        engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
		return engineOptions;
	}

	@Override
	protected void onCreateResources() {
		
		}

	@Override
	protected Scene onCreateScene() {
		_scene = new Scene();
		
		return _scene;
	}

	@Override
	protected int getLayoutID() {
		// TODO Auto-generated method stub
		return R.layout.thongtin;
	}

	@Override
	protected int getRenderSurfaceViewID() {
		// TODO Auto-generated method stub
		return R.id.andengine_rendersurfaceview;
	}
	
	public void CreateCaiDat(){
		
		sb_amThanh = (SeekBar) dialog.findViewById(R.id.sb_amthanh);
		sb_amThanh.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
			@Override
			public void onStopTrackingTouch(SeekBar seekBar) {
				// TODO Auto-generated method stub
			}
			
			@Override
			public void onStartTrackingTouch(SeekBar seekBar) {
				// TODO Auto-generated method stub
			}
			
			@Override
			public void onProgressChanged(SeekBar seekBar, int progress,
					boolean fromUser) {
				// TODO Auto-generated method stub
				Log.e("seek bar", "seek bar: "+sb_amThanh.getProgress());
			}
		});
				
		
		
		
		this.img_Close_CaiDat = (ImageView) dialog.findViewById(R.id.img_closecaidat);
		this.img_Close_CaiDat.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Log.e("close click", "close click");
				dialog.dismiss();
			}
		});
	}
}
